export const images = import.meta.glob('@/assets/icons/*.(png|jpeg|jpg)',{
    import: 'default',
    eager: true,
})
// 地区别名
export const areaAlias = {
  五峰县: '五峰土家族自治县',
  长阳县: '长阳土家族自治县'
};

// 地区中线点等配置
export const mapConfig = {
  湖北省: {
    center: [111.301861, 31.054498],
    zoom: 6.6
  },
  武汉: {
    center: [114.305392, 30.653098],
    zoom: 8.4
  },
  荆州: {
    center: [112.51825975931293, 29.983466904392714],
    zoom: 8.4
  },
  黄石: {
    center: [115.02501134915792, 29.937045252745847],
    zoom: 9
  },
  宜昌: {
    center: [110.903307744, 30.682531],
    zoom: 8
  },
  襄阳: {
    center: [111.902414, 31.808986],
    zoom: 8
  },
  孝感: {
    center: [113.79276267940384, 31.115316319421524],
    zoom: 8.3
  },
  荆门: {
    center: [112.5986101466458, 31.00147588890715],
    zoom: 8.5
  },
  黄冈: {
    center: [115.080973, 30.641495],
    zoom: 8
  },
  鄂州: {
    center: [114.72949176223943, 30.32900647595109],
    zoom: 9.5
  },
  咸宁: {
    center: [114.21739203519542, 29.60941668],
    zoom: 8.4
  },
  十堰: {
    center: [110.00600899, 32.387813823575684],
    zoom: 8
  },
  随州: {
    center: [113.39902171989189, 31.901385152494782],
    zoom: 8.5
  },
  恩施: {
    center: [109.55227032393589, 30.28836973507579],
    zoom: 7.6
  },
  神农架: {
    center: [110.50248917102454, 31.607894727569146],
    zoom: 9
  },

  // 区县
  洪山区: {
    center: [114.343202, 30.500471],
    zoom: 11
  },
  武昌区: {
    center: [114.316082, 30.554120],
    zoom: 11
  },
  汉阳区: {
    center: [114.218724, 30.553905],
    zoom: 11
  },
  江夏区: {
    center: [114.321632, 30.375722],
    zoom: 11
  },
  硚口区: {
    center: [114.214920, 30.582202],
    zoom: 11
  },
  青山区: {
    center: [114.385545, 30.639623],
    zoom: 11
  },
  蔡甸区: {
    center: [114.029230, 30.582151],
    zoom: 11
  },
  新洲区: {
    center: [114.801258, 30.841423],
    zoom: 11
  },
  汉南区: {
    center: [114.084589, 30.308806],
    zoom: 11
  },
  黄陂区: {
    center: [114.375836, 30.881289],
    zoom: 11
  },
  东西湖区: {
    center: [114.137094, 30.620065],
    zoom: 11
  },
  江岸区: {
    center: [114.309099, 30.600065],
    zoom: 11
  },
  江汉区: {
    center: [114.270996, 30.601583],
    zoom: 11
  },
  沙市区: {
    center: [112.355583, 30.311056],
    zoom: 10.5
  },
  荆州区: {
    center: [112.010185, 30.352831],
    zoom: 9.5
  },
  松滋市: {
    center: [111.579893, 30.096768],
    zoom: 9.5
  },
  石首市: {
    center: [112.425454, 29.720938],
    zoom: 9.5
  },
  洪湖市: {
    center: [113.466433, 29.905489],
    zoom: 9.5
  },
  监利市: {
    center: [112.932418, 29.8627870],
    zoom: 9
  },
  江陵县: {
    center: [112.424664, 30.101822],
    zoom: 10
  },
  公安县: {
    center: [112.029648, 29.958336],
    zoom: 9
  },
  下陆区: {
    center: [114.961192, 30.173840],
    zoom: 11
  },
  铁山区: {
    center: [114.901412, 30.206592],
    zoom: 11
  },
  黄石港区: {
    center: [115.065993, 30.223010],
    zoom: 11
  },
  西塞山区: {
    center: [115.109955, 30.204924],
    zoom: 11
  },
  大冶市: {
    center: [114.78046, 30.096263],
    zoom: 9.6
  },
  阳新县: {
    center: [115.015227, 29.830257],
    zoom: 9.6
  },
  西陵区: {
    center: [111.285572, 30.710787],
    zoom: 11
  },
  伍家岗区: {
    center: [111.360765, 30.644066],
    zoom: 11
  },
  点军区: {
    center: [111.148287, 30.673405],
    zoom: 11
  },
  猇亭区: {
    center: [111.406403447, 30.544429535],
    zoom: 11
  },
  夷陵区: {
    center: [111.186348, 30.980021],
    zoom: 9
  },
  当阳市: {
    center: [111.788312, 30.821266],
    zoom: 9.4
  },
  远安县: {
    center: [111.440508, 31.150869],
    zoom: 9.6
  },
  兴山县: {
    center: [110.746804, 31.348196],
    zoom: 9.6
  },
  枝江市: {
    center: [111.760530, 30.425940],
    zoom: 9.6
  },
  宜都市: {
    center: [111.400006, 30.308326],
    zoom: 9.6
  },
  五峰土家族自治县: {
    center: [110.67374, 30.156741],
    zoom: 9.6
  },
  长阳土家族自治县: {
    center: [110.707242, 30.472763],
    zoom: 9.6
  },
  秭归县: {
    center: [110.707711, 30.895897],
    zoom: 9.6
  },
  襄城区: {
    center: [112.033728, 31.910180],
    zoom: 10
  },
  樊城区: {
    center: [111.955577, 32.104961],
    zoom: 10
  },
  襄州区: {
    center: [112.212016, 32.187164],
    zoom: 9
  },
  枣阳市: {
    center: [112.771959, 32.058818],
    zoom: 9
  },
  宜城市: {
    center: [112.257788, 31.659806],
    zoom: 9.6
  },
  老河口市: {
    center: [111.674928, 32.386760],
    zoom: 9.6
  },
  南漳县: {
    center: [111.738905, 31.604635],
    zoom: 9
  },
  谷城县: {
    center: [111.352982, 32.263849],
    zoom: 9
  },
  保康县: {
    center: [111.001308, 31.758310],
    zoom: 9
  },
  孝南区: {
    center: [113.910942, 30.916933],
    zoom: 10
  },
  应城市: {
    center: [113.572707, 30.928370],
    zoom: 10
  },
  汉川市: {
    center: [113.539149, 30.661243],
    zoom: 9.5
  },
  安陆市: {
    center: [113.615071857, 31.2638559073],
    zoom: 9.5
  },
  孝昌县: {
    center: [113.998009, 31.258159],
    zoom: 9.5
  },
  大悟县: {
    center: [114.127022, 31.561164],
    zoom: 9.5
  },
  云梦县: {
    center: [113.753554, 31.020983],
    zoom: 9.5
  },
  东宝区: {
    center: [112.101351, 31.151957],
    zoom: 9.5
  },
  掇刀区: {
    center: [112.207832, 30.873430],
    zoom: 10
  },
  钟祥市: {
    center: [112.47584995, 31.155760566],
    zoom: 9
  },
  京山市: {
    center: [113.119566, 31.018457],
    zoom: 9
  },
  沙洋县: {
    center: [112.388581, 30.609221],
    zoom: 9.5
  },
  黄州区: {
    center: [114.880086, 30.534367],
    zoom: 10
  },
  武穴市: {
    center: [115.561217, 29.944107],
    zoom: 9.5
  },
  麻城市: {
    center: [115.008163, 31.272739],
    zoom: 9
  },
  团风县: {
    center: [115.034990072, 30.765188663],
    zoom: 9.5
  },
  红安县: {
    center: [114.618236, 31.288153],
    zoom: 9
  },
  罗田县: {
    center: [115.399221, 30.883120],
    zoom: 9
  },
  英山县: {
    center: [115.681258, 30.834959],
    zoom: 9.5
  },
  黄梅县: {
    center: [115.944218, 30.000453],
    zoom: 9.5
  },
  浠水县: {
    center: [115.265535, 30.491867],
    zoom: 9.5
  },
  蕲春县: {
    center: [115.437007, 30.325964],
    zoom: 9.5
  },
  华容区: {
    center: [114.61855257, 30.45158697],
    zoom: 10
  },
  鄂城区: {
    center: [114.861614, 30.350572],
    zoom: 10
  },
  梁子湖区: {
    center: [114.584731, 30.200141],
    zoom: 10
  },
  咸安区: {
    center: [114.25376053, 29.7883788539],
    zoom: 9.6
  },
  赤壁市: {
    center: [113.900628, 29.724692],
    zoom: 9.6
  },
  嘉鱼县: {
    center: [113.939277, 29.970737],
    zoom: 9.6
  },
  崇阳县: {
    center: [114.039828, 29.395605],
    zoom: 9.6
  },
  通城县: {
    center: [113.816966, 29.245269],
    zoom: 9.6
  },
  通山县: {
    center: [114.482606, 29.605376],
    zoom: 9.6
  },
  茅箭区: {
    center: [110.783621, 32.501929],
    zoom: 10
  },
  张湾区: {
    center: [110.669135, 32.652293],
    zoom: 10
  },
  郧阳区: {
    center: [110.812050, 32.834775],
    zoom: 8.6
  },
  丹江口市: {
    center: [111.213127, 32.540157],
    zoom: 9
  },
  房县: {
    center: [110.521115193, 32.001697775],
    zoom: 8.6
  },
  郧西县: {
    center: [110.125983, 32.993182],
    zoom: 9
  },
  竹山县: {
    center: [110.228693, 32.024875],
    zoom: 8.6
  },
  竹溪县: {
    center: [109.715304, 32.018255],
    zoom: 8.6
  },
  曾都区: {
    center: [113.4004666969, 31.5111833162],
    zoom: 9
  },
  广水市: {
    center: [113.825889, 31.616853],
    zoom: 9
  },
  随县: {
    center: [113.299528, 31.853833],
    zoom: 8.6
  },
  恩施市: {
    center: [109.509828, 30.202388],
    zoom: 9
  },
  利川市: {
    center: [108.936375, 30.150996],
    zoom: 8.6
  },
  建始县: {
    center: [109.726667, 30.501555],
    zoom: 9
  },
  巴东县: {
    center: [110.340756, 30.802324],
    zoom: 8.6
  },
  宣恩县: {
    center: [109.491485, 29.786899],
    zoom: 9
  },
  咸丰县: {
    center: [109.109726, 29.665202],
    zoom: 9
  },
  来凤县: {
    center: [109.107697, 29.393474],
    zoom: 9.6
  },
  鹤峰县: {
    center: [110.033662, 29.890171],
    zoom: 9
  }
};

// 地图图标覆盖物
export const markerConfig = (type, levelId) => {
  // 变电站
  if (+type === 22) {
    if (levelId === 8 || levelId === 12) {
      return images['/src/assets/icons/1000.png'];
    } if (levelId === 11 || levelId === 7) {
      return images['/src/assets/icons/500.png'];
    } if (levelId === 6) {
      return images['/src/assets/icons/220.png'];
    } if (levelId === 5) {
      return images['/src/assets/icons/110.png'];
    } if (levelId === 3) {
      return images['/src/assets/icons/35.png'];
    }
  }
  const map = {
    23: images['/src/assets/icons/hd.jpg'], // 火电站
    24: images['/src/assets/icons/sd.jpg'], // 水电站
    25: images['/src/assets/icons/fd.jpg'], // 风电站
    27: images['/src/assets/icons/qy.jpg'], // 牵引站
    29: images['/src/assets/icons/cx.jpg'], // 抽蓄站
    30: images['/src/assets/icons/fd.jpg'], // 风光一体
    31: images['/src/assets/icons/gf.jpg'], // 光伏
    32: images['/src/assets/icons/hl.jpg'], // 换流站
    33: images['/src/assets/icons/cn.jpg'] // 储能站
  };
  // eslint-disable-next-line import/no-dynamic-require
  return map[+type] ?? images['/src/assets/icons/500.png'];
};

export const urls = {
  35: images['/src/assets/icons/35.png'],
  110: images['/src/assets/icons/110.png'],
  220: images['/src/assets/icons/220.png'],
  500: images['/src/assets/icons/500.png'],
  1000: images['/src/assets/icons/1000.png'],
  // 23: images['/src/assets/icons/hd.jpg'], // 火电站
  // 24: images['/src/assets/icons/sd.jpg'], // 水电站
  // 25: images['/src/assets/icons/fd.jpg'], // 风电站
  // 29: images['/src/assets/icons/cx.jpg'], // 抽蓄站
  // 30: images['/src/assets/icons/fd.jpg'], // 风光一体
  '23-3': images['/src/assets/icons/hd-35.png'], // 35kv 火电站
  '23-5': images['/src/assets/icons/hd-110.png'], // 110kv 火电站
  '23-6': images['/src/assets/icons/hd-220.png'], // 220kv 火电站
  '23-7': images['/src/assets/icons/hd-500.png'], // 500kv ±500kv 火电站
  '23-11': images['/src/assets/icons/hd-500.png'], // 500kv ±500kv 火电站
  '23-8': images['/src/assets/icons/hd-1000.png'], // 1000kV ±800kV 火电站
  '23-12': images['/src/assets/icons/hd-1000.png'], // 1000kV ±800kV 火电站

  '24-3': images['/src/assets/icons/sd-35.png'], // 35kv 水电站
  '24-5': images['/src/assets/icons/sd-110.png'], // 110kv 水电站
  '24-6': images['/src/assets/icons/sd-220.png'], // 220kv 水电站
  '24-7': images['/src/assets/icons/sd-500.png'], // 500kv ±500kv 水电站
  '24-11': images['/src/assets/icons/sd-500.png'], // 500kv ±500kv 水电站
  '24-8': images['/src/assets/icons/sd-1000.png'], // 1000kV ±800kV 水电站
  '24-12': images['/src/assets/icons/sd-1000.png'], // 1000kV ±800kV 水电站

  '25-3': images['/src/assets/icons/fd-35.png'], // 35kv 风电站
  '25-5': images['/src/assets/icons/fd-110.png'], // 110kv 风电站
  '25-6': images['/src/assets/icons/fd-220.png'], // 220kv 风电站
  '25-7': images['/src/assets/icons/fd-500.png'], // 500kv ±500kv风电站
  '25-11': images['/src/assets/icons/fd-500.png'], // 500kv ±500kv风电站
  '25-8': images['/src/assets/icons/fd-1000.png'], // 1000kV ±800kV风电站
  '25-12': images['/src/assets/icons/fd-1000.png'], // 1000kV ±800kV风电站

  '30-3': images['/src/assets/icons/fd-35.png'], // 35kv 风光一体电站
  '30-5': images['/src/assets/icons/fd-110.png'], // 110kv 风光一体电站
  '30-6': images['/src/assets/icons/fd-220.png'], // 220kv 风光一体电站
  '30-7': images['/src/assets/icons/fd-500.png'], // 500kv ±500kv风光一体电站
  '30-11': images['/src/assets/icons/fd-500.png'], // 500kv ±500kv风光一体电站
  '30-8': images['/src/assets/icons/fd-1000.png'], // 1000kV ±800kV风光一体电站
  '30-12': images['/src/assets/icons/fd-1000.png'], // 1000kV ±800kV风光一体电站

  '29-3': images['/src/assets/icons/cx-35.png'], // 35kv 储蓄电站
  '29-5': images['/src/assets/icons/cx-110.png'], // 110kv 储蓄电站
  '29-6': images['/src/assets/icons/cx-220.png'], // 220kv 储蓄电站
  '29-7': images['/src/assets/icons/cx-500.png'], // 500kv ±500kv储蓄电站
  '29-11': images['/src/assets/icons/cx-500.png'], // 500kv ±500kv储蓄电站
  '29-8': images['/src/assets/icons/cx-1000.png'], // 1000kV ±800kV储蓄电站
  '29-12': images['/src/assets/icons/cx-1000.png'], // 1000kV ±800kV储蓄电站

  '31-3': images['/src/assets/icons/gf-35.png'], // 35kv 光伏
  '31-5': images['/src/assets/icons/gf-110.png'], // 110kv 光伏
  '31-6': images['/src/assets/icons/gf-220.png'], // 220kv 光伏
  '31-7': images['/src/assets/icons/gf-500.png'], // 500kv ±500kv光伏
  '31-11': images['/src/assets/icons/gf-500.png'], // 500kv ±500kv光伏
  '31-8': images['/src/assets/icons/gf-1000.png'], // 1000kV ±800kV光伏
  '31-12': images['/src/assets/icons/gf-1000.png'], // 1000kV ±800kV光伏

  // 24: images['/src/assets/icons/sd.jpg'], // 水电站
  // 25: images['/src/assets/icons/fd.jpg'], // 风电站
  // 29: images['/src/assets/icons/cx.jpg'], // 抽蓄站
  // 30: images['/src/assets/icons/fd.jpg'], // 风光一体
  // 23: images['/src/assets/icons/icon.png'], // 火电站
  // 24: images['/src/assets/icons/icon.png'], // 水电站
  // 25: images['/src/assets/icons/icon.png'], // 风电站
  // 26: images['/src/assets/icons/icon.png'], // 开关站
  // 28: images['/src/assets/icons/icon.png'], // 配电站

  '26-3': images['/src/assets/icons/35.png'], // 开关站
  '26-5': images['/src/assets/icons/110.png'], // 开关站
  '26-6': images['/src/assets/icons/220.png'], // 开关站
  '26-7': images['/src/assets/icons/500.png'], // 开关站
  '26-11': images['/src/assets/icons/500.png'], // 开关站
  '26-8': images['/src/assets/icons/1000.png'], // 开关站
  '26-12': images['/src/assets/icons/1000.png'], // 开关站

  '28-3': images['/src/assets/icons/35.png'], // 配电站
  '28-5': images['/src/assets/icons/110.png'], // 配电站
  '28-6': images['/src/assets/icons/220.png'], // 配电站
  '28-7': images['/src/assets/icons/500.png'], // 配电站
  '28-11': images['/src/assets/icons/500.png'], // 配电站
  '28-8': images['/src/assets/icons/1000.png'], // 配电站
  '28-12': images['/src/assets/icons/1000.png'], // 配电站

  // 29: images['/src/assets/icons/icon.png'], // 抽蓄站
  // 30: images['/src/assets/icons/icon.png'], // 风光一体
  27: images['/src/assets/icons/qy.jpg'], // 牵引站
  // 31: images['/src/assets/icons/gf.jpg'], // 光伏
  32: images['/src/assets/icons/hl.jpg'], // 换流站
  33: images['/src/assets/icons/cn.jpg'], // 储能站
  arrow: images['/src/assets/icons/arrow-white.png'] // 箭头
};

// 无极缩放过滤数据
export const zoomFilter = (originData, zoom, voltageList) => {
  // 500kV及以上   -----》220kV及以上 ----》 110kV及以下
  let result;
  if (zoom <= 7) {
    result = originData?.filter((e) => e.levelId === 7 || e.levelId === 11 || e.levelId === 8);
    if (voltageList) {
      voltageList.forEach((v) => {
        v.checked = false;
      });
      ['7', '8', '11'].forEach((v) => {
        voltageList.find((e) => e.levelId === v).checked = true;
      });
    }
  } else if (zoom > 7 && zoom <= 9) {
    result = originData?.filter((e) => e.levelId === 6 || e.levelId === 7 || e.levelId === 11 || e.levelId === 8 || e.levelId === 9 || e.levelId === 12);
    if (voltageList) {
      voltageList.forEach((v) => {
        v.checked = false;
      });
      ['6', '7', '8', '9', '11', '12'].forEach((v) => {
        voltageList.find((e) => e.levelId === v).checked = true;
      });
    }
  } else {
    result = originData?.filter((e) => e.levelId === 3 || e.levelId === 5);
    if (voltageList) {
      voltageList.forEach((v) => {
        v.checked = false;
      });
      ['3', '5'].forEach((v) => {
        voltageList.find((e) => e.levelId === v).checked = true;
      });
    }
  }
  return result;
};
